package com.miaoke.net;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class RpcSocketServer {
    private static ExecutorService executorService= Executors.newFixedThreadPool(300);
    public static void startUp(int port){
        Socket socket=null;
        try {
            ServerSocket serverSocket=new ServerSocket(port);
            while (true){
                socket = serverSocket.accept();
                executorService.execute(new RpcRequestHandler(socket));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
